package Api.Date;

import java.util.Date;

public class Demo {
    public static void main(String[] args) {
        Date d = new Date();
        System.out.println(d);
        //getTime()-->获取时间毫秒值
        long time = d.getTime();
        System.out.println(time);

        //修改时间戳可以显示时间戳所对应的时间
        time+=2*1000;
        Date d1 = new Date(time);
        System.out.println(d1);

        //setTime(long time) -->设置时间毫秒值
        Date d2 = new Date(time);
        d2.setTime(1000);
        System.out.println(d2);
    }
}
